#include "TimeManager.h"
#include <Arduino.h>
#include <time.h>

namespace TimeManager {
    void syncTime() {
        configTime(8*3600, 0, "ntp1.aliyun.com", "ntp2.aliyun.com");
        Serial.print("等待时间同步");
        time_t now = time(nullptr);
        while (now < 24*3600) {
            delay(500);
            Serial.print(".");
            now = time(nullptr);
        }
        Serial.println("\n时间已同步: " + String(ctime(&now)));
    }
}